package top.lshaci.learning.springboot.redis.handle;

import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.connection.MessageListener;
import org.springframework.stereotype.Component;

/**
 * MessageHandle
 *
 * <pre>
 *     也可以通过实现 {@link MessageListener} 方式实现
 *
 *     MessageListenerAdapter 中的 onMessage 方法在接收到消息时，处理如下：
 *     // Check whether the delegate is a MessageListener impl itself.
 * 	   // In that case, the adapter will simply act as a pass-through.
 *     if (delegate != this) {
 *         if (delegate instanceof MessageListener) {
 *             ((MessageListener) delegate).onMessage(message, pattern);
 *             return;
 *         }
 *     }
 * </pre>
 *
 * @author lshaci
 * @since 1.0.0
 */
@Slf4j
@Component
public class MessageHandle {

    public void handleMessage(Object message, String channel) {
        log.debug("监听 {}, 我收到消息: {}.", channel, message);
    }
}
